#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <stdlib.h>
#include <ctime>
#include <iomanip>
uint64_t sec(const char *t)
{
    int h,m,s;
    char *end;
    h = strtoul(t, &end, 10);
    m = strtoul(end+1, &end, 10);
    s = strtoul(end+1, &end, 10);
    return h*3600+m*60+s;
}

int main()
{
    int n;
    double dis;
    std::cin>>n>>dis;

    while (1) {
        int64_t sum=0;
        int no;
        if(!(std::cin>>no))
            return 0;
        bool inf = false;
        for(int i = 0; i < n; i++)
        {
            char str[9]={0};
            std::cin>>str;
            if(strcmp(str,"-:--:--")==0)
            {
                inf=true;
            }
            sum+=sec(str);
        }
        std::cout<<std::setw(3)<<std::setfill(' ')<<no<<": ";
        if(inf)
            std::cout<<"-\n";
        else{
            double min=sum/dis/60;
            int sec=round((min-(int)min)*60);
            int imin = min+sec/60;
            std::cout<<std::setw(1)<<std::setfill('0')<<imin<<":";
            std::cout<<std::setw(2)<<std::setfill('0')<<sec%60<<" min/km\n";
        }
    }
    return 0;
}
